﻿namespace CookieTerm
{
    using System;

    /// <summary>
    /// Provides an interface to hide UI specific operations.
    /// </summary>
    public interface IWindow
    {
        EventHandler<ConsoleInputReceivedEventArgs> OnConsoleInputReceived { get; set; }

        /// <summary>
        /// Gets or sets status bar text
        /// </summary>
        string StatusText { get; set; }

        /// <summary>
        /// Displays a modal dialog for the user to enter username and password. This method MUST be called from a UI thread.
        /// </summary>
        /// <param name="userName">Username filled by the user</param>
        /// <param name="password">Password filled by the user</param>
        /// <returns>True if the user pressed OK, false if cancelled</returns>
        bool PromptForUserNamePassword(out string username, out string password);

        /// <summary>
        /// Displays a modal dialog. This method MUST be called from a UI thread.
        /// </summary>
        /// <param name="message">Message to display</param>
        void ShowMessageBox(string message, EventHandler continuation);

        void StartClosing();

        /// <summary>
        /// Resets the anti idle counter if anti idle is enabled. I chose to use UI timers from GTK and WinForms, thus the need for this method.
        /// </summary>
        void ResetAntiIdle();

        /// <summary>
        /// Redraw a cell on the console
        /// </summary>
        /// <param name="row">Row</param>
        /// <param name="col">Column</param>
        void InvalidateCell(int row, int col);

        /// <summary>
        /// Redraw a rectangular area on the console
        /// </summary>
        /// <param name="top">Top</param>
        /// <param name="left">Left</param>
        /// <param name="bottom">Bottom</param>
        /// <param name="right">Right</param>
        void InvalidateRect(int top, int left, int bottom, int right);
    }
}